<template>
  <view class="room-head sure">基本信息</view>
  <uni-list>
    <uni-list-item v-if="formData.type===0" title="企业名称" :rightText="formData.enterpriseName"/>
    <uni-list-item title="联系人" :rightText="formData.contacts"/>
    <uni-list-item title="联系方式" :rightText="formData.phone"/>
    <uni-list-item title="邮箱" :rightText="formData.email"/>
    <uni-list-item v-if="formData.type===1" title="证件类型" :rightText="formData.certName"/>
    <uni-list-item v-if="formData.type===1" title="证件号" :rightText="formData.certNumber"/>
    <uni-list-item v-if="formData.type===0" title="统一社会信用代码" :rightText="formData.certNumber"/>
  </uni-list>
  <view class="room-interval sure"></view>
  <view class="room-head sure">房源信息</view>
  <uni-list>
    <uni-list-item title="户型" :rightText="formData.houseName"/>
    <uni-list-item title="数量" :rightText="formData.number"/>
    <uni-list-item title="租金标准" :rightText="formData.amount + '元/月'"/>
    <uni-list-item title="租赁保证金标准" :rightText="formData.deposit + '元/套'"/>
    <uni-list-item title="预定金" :rightText="formData.reservePrice + '元'"/>
  </uni-list>
  <view class="room-btn">
    <button class="btn" @click="formSubmit">提交审核</button>
  </view>
</template>
<script setup>
import { ref, inject} from "vue"
import {onShow, } from "@dcloudio/uni-app";
import {addUserApplyForReserve} from "@/package_kuafu_apartment/pages/api/house-details"
import UniListItem from "@/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue";
import UniList from "@/uni_modules/uni-list/components/uni-list/uni-list.vue";
import {customNav} from "@/utils/customNav";
const formData = ref({})
onShow(() => {
  uni.getStorage({
    key: 'reserve_house',
    success: function (res) {
      console.log('getStorage', res.data);
      formData.value = res.data
      formData.value.reservePrice = res.data.reservePrice * res.data.number
    }
  });
})

const packageKuaFuPath = inject('packageKuaFuPath')
async function formSubmit() {
  let res = await addUserApplyForReserve(formData.value)
  let {msg} = res
  uni.showModal({
    title: '提示',
    showCancel: false,
    content: msg,
    success: function (res) {
      if (res.confirm) {
        customNav(`${packageKuaFuPath}/home/index`)
      }
    }
  });

}

</script>
<style lang="less" scoped>
@import "./style/index.less";
</style>
